"""
@Project:ruiji
@File:myredis.py
@Author:马可
@Date:下午 02:30
"""

import redis

class MyRedis:
    def __init__(self):
        self.pool = redis.ConnectionPool()
        self.r = redis.Redis(connection_pool=self.pool)

    # str 存
    def set_str(self,key,v,time=0):
        if time>0:
            self.r.setex(key,time,v)
        else:
            self.r.set(key,v)

    # 取
    def get_str(self,key):
        return self.r.get(key)


r = MyRedis()